<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://unpkg.com/vue@next"></script>
</head>
<body>
    <div id="event-handling">
        <p>{{ message }}</p>
        <button v-on:click="reverseMessage">相反的信息</button>
    </div>
</body>
<script>
    const EventHanding = {
        data(){
            return { message:'你好 vue.js！'}
        },
        methods:{
            reverseMessage(){
                this.message = this.message
                    .split('')
                    .reverse()
                    .join('')
            }
        }
    }
    Vue.createApp(EventHanding).mount("#event-handling")
</script>
</html>

<!-- 通过v-on指令添加 点击事件click
将message内容反转，
    函数reverseMessage，通过切割、反转、拼接等字符串方法（split、reverse、join） -->